package com.hxzy.source.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hxzy.source.entity.Goods;
import com.hxzy.source.mapper.GoodsMapper;
import com.hxzy.source.service.GoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author mingqian.Wu
 * @since 2023-06-26
 */
@Service
@DataSource(DataSourceType.SOURCE)
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {

    @Override
    public List<Goods> searchGoods(Goods goods) {
        QueryWrapper<Goods>queryWrapper=new QueryWrapper<>();
        queryWrapper.like(Objects.nonNull(goods.getGoodsName()),"goods_name",goods.getGoodsName());
        queryWrapper.eq(Objects.nonNull(goods.getGoodsStatus()),"goods_status",goods.getGoodsStatus());
        queryWrapper.eq(Objects.nonNull(goods.getServiceType()),"service_type",goods.getServiceType());
        List<Goods> goods1 = baseMapper.selectList(queryWrapper);
        return goods1;
    }
}
